package com.luoran.bartalks.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.luoran.bartalks.dao.IBtMaterielTypeDao;
import com.luoran.bartalks.entity.biz.BtMaterielType;
import com.luoran.bartalks.service.IBtMaterielTypeService;

@Service
public class BtMaterielTypeService implements IBtMaterielTypeService {

	@Autowired
	private IBtMaterielTypeDao dao;

	// 获取物料类型集合
	@Override
	public List<BtMaterielType> getMaterielTypeByCompanyId(String companyId) {
		return dao.getMaterielTypeByCompanyId(companyId);
	}

	// 校验物料类型编码是否被占用
	@Override
	public BtMaterielType getMaterielTypeByTypeCode(String typeCode, String companyId) {
		return dao.getMaterielTypeByTypeCode(typeCode, companyId);
	}

	// 添加物料类型
	@Override
	public BtMaterielType addMaterielType(BtMaterielType btMaterielType) {
		dao.insert(btMaterielType);
		return btMaterielType;
	}

	// 更新/逻辑删除
	@Override
	public int updateMaterielTypeById(BtMaterielType materielType) {
		return dao.updateTemplateById(materielType);
	}

}
